﻿

namespace Power.Models
{
    /// <summary>
    /// 缺陷相关信息
    /// </summary>
    public class DefectEntity : BaseModel// NotifyPropertyChangedBase, IsChangedInterface<DefectInfo>, HasKeyInterface<int>
    {
        public DefectEntity()
        {
        }

        public DefectEntity(int no)
        {
            No = no;
        }

        //检测序号
        private int _detectNo;
        public int DetectNo
        {
            get { return _detectNo; }
            set { _detectNo = value; }
        }

        //缺陷序号
        private int _no;
        public int No
        {
            get { return _no; }
            set { _no = value;}
        }

        //缺陷图片名称
        private string _picName;
        public string PicName
        {
            get { return _picName; }
            set { _picName = value; RaisePropertyChanged();}
        }

        //缺陷图片URI
        private string _picUri;
        public string PicUri
        {
            get { return _picUri; }
            set { _picUri = value; RaisePropertyChanged(); }
        }

        //缺陷类型
        private string _type;
        public string Type
        {
            get { return _type; }
            set { _type = value; RaisePropertyChanged(); }
        }

        //缺陷名称
        private string _name;
        public string Name
        {
            get { return _name; }
            set {
                _name = value;
                RaisePropertyChanged();
            }
        }

        //缺陷等级
        private int? _level;
        public int? Level
        {
            get { return _level; }
            set { _level = value; RaisePropertyChanged(); }
        }

        //缺陷长度
        private double _length;
        public double Length
        {
            get { return _length; }
            set { _length = value; RaisePropertyChanged(); }
        }

        //缺陷环向
        private string _circleDirection;
        public string CircleDirection
        {
            get { return _circleDirection; }
            set { _circleDirection = value; RaisePropertyChanged(); }
        }

        //缺陷识别日期
        private string _detectDate;
        public string DetectDate
        {
            get { return _detectDate; }
            set { _detectDate = value; RaisePropertyChanged(); }
        }

        //缺陷起始位置
        private double _startPos;
        public double StartPos
        {
            get { return _startPos; }
            set { _startPos = value; RaisePropertyChanged(); }
        }

        //缺陷终止位置
        private double _endPos;
        public double EndPos
        {
            get { return _endPos; }
            set { _endPos = value; RaisePropertyChanged(); }
        }

        //缺陷CODE
        private string _code;
        public string Code
        {
            get { return _code; }
            set { _code = value; }
        }

        //缺陷描述
        private string _describe = "";
        public string Describe
        {
            get { return _describe; }
            set { _describe = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 是否有变动
        /// </summary>
        /// <param name="raw"></param>
        /// <returns></returns>
        public bool IsChanged(DefectEntity raw)
        {
            return DetectNo != raw.DetectNo ||No != raw.No || PicName != raw.PicName || PicUri != raw.PicUri || Type != raw.Type || Name != raw.Name
                || Level != raw.Level || StartPos != raw.StartPos || Length != raw.Length || CircleDirection != raw.CircleDirection
                || DetectDate != raw.DetectDate || EndPos != raw.EndPos || Code != raw.Code || Describe != raw.Describe;
        }

        /// <summary>
        /// 获取key
        /// </summary>
        /// <returns></returns>
        public int GetKey()
        {
            return No;
        }




        //缺陷名称
        private string _nameDesc;
        public string NameDesc
        {
            get { return _nameDesc; }
            set
            {
                _nameDesc = value;
                RaisePropertyChanged();
            }
        }
    }
}
